﻿namespace PowerSong.SongDatabase
    {
    using System;
    using System.IO;

    public class SubStyleFadeDetails
        {

        public FadeType Type { get; set; }

        /// <summary>
        /// Gets or sets the duration of the fade effect, in milliseconds.
        /// </summary>
        /// <value>The duration of the fade effect in milliseconds.</value>
        public int Duration { get; set; }

        public SubStyleFadeDetails()
            {
            this.Type = FadeType.None;
            this.Duration = 0;
            }

        internal SubStyleFadeDetails(BinaryReader reader)
            {
            this.Type = (FadeType)Enum.Parse(typeof(FadeType), reader.ReadString());
            this.Duration = reader.ReadInt32();
            }

        /// <param name="duration">The duration of the fade effect, in milliseconds.</param>
        public SubStyleFadeDetails(FadeType type, int duration)
            {
            this.Type = type;
            this.Duration = duration;
            }

        internal void WriteDetails(BinaryWriter writer)
            {
            writer.Write(Type.ToString());
            writer.Write(this.Duration);
            }

        }

    }
